package com.kaiyidiannao.activity.tour;

import android.content.Intent;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.EditText;
import com.kaiyidiannao.common.BaseActionBarActivity;
import com.kaiyidiannao.main.R;
import com.kaiyidiannao.view.ActionBarView;

/**
 * Created by david on 25/04/14.
 * 评论回复页面
 */
public class TourCommentActivity extends BaseActionBarActivity {

    private EditText editText;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.tour_comment_activity);

        findActionBar();
    }

    private void findActionBar() {
        actionBarView = (ActionBarView) findViewById(R.id.actionbar);
        actionBarView.setTitle("评论");
        actionBarView.button_right_icon2.setVisibility(View.VISIBLE);
        actionBarView.button_right_icon2.setImageBitmap(BitmapFactory.decodeResource(getResources(), R.drawable.publish));
        actionBarView.button_right_icon2.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                editText = (EditText) findViewById(R.id.tour_comment_context_edit);
                //跳回详情界面
                if (!TextUtils.isEmpty(editText.getText())) {
                    Intent intent = new Intent();
                    intent.putExtra("result", editText.getText().toString());
                    setResult(RESULT_OK, intent);
                    finish();
                } else {
                    showToast("评论内容不能为空");
                }
            }
        });
    }
}